package com.suxin.test.netty.adv.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.example.netty.adv.vo.Message;
import org.example.netty.adv.vo.MessageType;

/**
 * @Author: tang
 * @Description:
 * @Date 2025/1/21 17:24
 */
@Slf4j
public class ClientLoginBoundChannel extends SimpleChannelInboundHandler<Message> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Message msg) throws Exception {
        // 心跳请求
        byte type = msg.getMessageHeader().getType();
        if (MessageType.LOGIN_REQ.value() == type) {
            // todo
        }else {
            // 投递给下一个链条
            ctx.fireChannelRead(msg);
        }

    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        // todo 登陆请求构建 send

    }
}
